# encoding: utf-8
#
#
require 'rubygems'
require 'active_record'
require 'mysql2'
#ActiveRecord::Base
=begin
ActiveRecord::Base.establish_connection(
:adapter => "mysql2",
:host => "aaa.nyrencai.com",
:database => "nyrencai",
:username => "root",
:password => "cinternet_sql"
)

class JobMember < ActiveRecord::Base
  self.table_name = "job_member"
end

yuan =  JobMember.where(m_typeid: 2).select('m_id,m_name').inject([]){|a,b|a << [b.m_name,b.m_id];a}

=end

ActiveRecord::Base.establish_connection(
:adapter => "mysql2",
:host => "www.nyrencai.com",
:database => "nyrencai",
:username => "root",
:password => "guangyi131415",
:encoding => "utf8"
)

#class QsCompanyProfile < ActiveRecord::Base
  #self.table_name = "qs_company_profile"
#end

#xianzai =  QsCompanyProfile.select('id,companyname').inject({}){|a,b|a[b.companyname]=b.id;a}

#result = yuan.inject([]){|a,b|a << (b << xianzai[b[0]]);a}


class Xinjiuid < ActiveRecord::Base
  self.table_name = "xinjiuids"
end
result = Xinjiuid.all

result.each do |r|
  #Xinjiuid.create :company_name => r[0],:yuan_id => r[1],:xin_id => r[2]
  #puts "#{r.yuan_id}=>#{r.xin_id]},"
  puts r.yuan_id.to_s + "=>" + r.xin_id.to_s + ","
end
